<template>
<div class="page-container page-container-detail-page">
    <!--面包屑-->
    <div class="breadcrumb">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>营销中心</el-breadcrumb-item>
            <el-breadcrumb-item>其他类促销</el-breadcrumb-item>
            <el-breadcrumb-item>抽奖详情</el-breadcrumb-item>
        </el-breadcrumb>
    </div>

    <!--审核弹框-->
    <el-dialog class="el-dialog-style" title="审核备注" :visible.sync="dialogFormVisible" :close-on-click-modal="false" @closed="handleClose">
        <el-form :model="verifyForm" ref="verifyForm" :rules="verifyFormRules" label-width="100%" :size="size" label-position="right" inline>
            <el-form-item class="textarea" prop="auditRemark">
                <el-input clearable type="textarea" :rows="4" v-model="verifyForm.auditRemark">
                </el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer" style="text-align:center">
            <el-button :size="size" type="primary" plain @click.native="reviewDialogNo(4)" class="cancelButton">不通过</el-button>
            <el-button :size="size" type="primary" @click.native="reviewDialog(11)" class="searchButton">通过</el-button>
        </div>
    </el-dialog>

    <!-- 奖品名称 -->
    <el-dialog title="查看奖品" :visible.sync="awardsRefNameVisible" class="awardsRefNameVisible" :close-on-click-modal="false">
        <div class="table-section" v-if="showGoods">
            <el-table :data="awardsRefNameForm" :header-cell-style="tableHeaderColor" ref="multipleTable" :row-class-name="tableRowClassName" :size="size">
                <el-table-column prop="thirdSkuId" label="商品ID" sortable align="center"></el-table-column>
                <el-table-column prop="goodsName" label="商品名称" align="center"></el-table-column>
                <el-table-column prop="goodsCategory" label="商品分类" align="center"></el-table-column>
                <el-table-column prop="storeName" label="所属商户" align="center"></el-table-column>
                <el-table-column prop="salePrice" label="原价（元）" align="center"></el-table-column>
            </el-table>
        </div>
        <el-table :data="awardsRefNameForm" :header-cell-style="tableHeaderColor" ref="multipleTable" :row-class-name="tableRowClassName" :size="size" v-else>
            <el-table-column fixed prop="id" label="优惠券活动ID"></el-table-column>
            <el-table-column fixed prop="promName" label="优惠券名称"></el-table-column>
        </el-table>
        <el-button type="primary" plain @click="awardsRefNameVisible=false" class="searchButton">确定</el-button>
    </el-dialog>

    <!--工具栏-->
    <div class="page-container-detail">
        <p class="pageName">抽奖详情</p>
        <div class="toolbar">
            <el-form :inline="true" :model="filters" :size="size" ref="filters">
                <el-form-item>
                    <span class="color333 font18">活动名称：</span>
                    <span class="color333 font18">{{lotteryInfoForm.activityName}}</span>
                </el-form-item>
                <el-form-item>
                    <span class="color333 font18">活动ID：</span>
                    <span class="color333 font18">{{lotteryInfoForm.promotionCode}}</span>
                </el-form-item>
                <el-form-item>
                    <span class="color333 font18">当前状态：</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 1">待提交</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 2">待审核</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 3">未开始</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 4">审核不通过</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 5">进行中</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 6">已过期</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 7">已关闭</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 8">已结束</span>
                    <span class="color333 font18" v-if="lotteryInfoForm.status == 9">活动草稿</span>
                </el-form-item>
            </el-form>
            <el-row class="search-button" style="width: 5.5%;">
                <kt-button label="提交审核" class="searchButton" :size="size" v-if="lotteryInfoForm.status == 1 || lotteryInfoForm.status == 4"  @click="submitReview" />
                <kt-button label="审核" class="searchButton" :size="size" v-if="lotteryInfoForm.status == 2"  @click="review" />
            </el-row>

        </div>
        <div class="tab-container tab-container-noPadding">
            <el-tabs type="border-card">
                <el-tab-pane label="抽奖规则">
                    <el-form ref="lotteryInfoForm" :model="lotteryInfoForm" class="form-horizontal">
                        <!-- 基本信息 -->
                        <div class="basicInfo">基本信息：</div>
                        <div class="item">
                            <el-form-item label="活动名称：" class="color333 long" label-width="176px">
                                <span class="color333 font16">{{lotteryInfoForm.activityName}}</span>
                            </el-form-item>
                            <el-form-item label="活动时间：" class="color333 long" label-width="176px">
                                <span class="font16 color333">{{lotteryInfoForm.effStartTime}} 至 {{lotteryInfoForm.effEndTime}}</span>
                            </el-form-item>
                            <el-form-item label="活动搜索词：" class="color333 long" label-width="176px">
                                <span class="color333 font16">{{lotteryInfoForm.activitySearch}}</span>
                            </el-form-item>
                            <el-form-item label="活动费用预算：" class="color333 long" label-width="176px">
                                <span class="color333 font16">{{lotteryInfoForm.activityBudget}}元</span>
                            </el-form-item>
                            <el-form-item label="预警比例：" class="color333 long" label-width="176px">
                                <span class="color333 font16">{{lotteryInfoForm.warningProportion}}%</span>
                            </el-form-item>
                        </div>
                        <!-- 活动规则 -->

                        <div class="basicInfo">活动规则：</div>
                        <div class="item">
                            <el-row>
                                <el-form-item label="抽奖模板：" class="color333 long" label-width="176px">
                                    <span v-if="lotteryInfoForm.lotteryTemplate==1" class="font16 color333">大转盘</span>
                                    <span v-if="lotteryInfoForm.lotteryTemplate==2" class="font16 color333">刮刮乐</span>
                                    <span v-if="lotteryInfoForm.lotteryTemplate==3" class="font16 color333">红包雨</span>
                                    <span v-if="lotteryInfoForm.lotteryTemplate==4" class="font16 color333">小we宝盒</span>
                                </el-form-item>
                            </el-row>
                            <el-row>
                                <el-form-item label="抽奖活动类型：" prop="costFreeDrawTimes" label-width="176px" class="long">
                                    <p v-if="lotteryInfoForm.lotteryType==1" style="line-height: 12px;">
                                        <span class="font16 color333">普通抽奖</span>
                                    </p>
                                    <p v-if="lotteryInfoForm.lotteryType==2" style="line-height: 12px;">
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawModel==1">任意订单抽奖，</span>
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawModel==2">支付订单抽奖，</span>
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawType==1">单次消费订单金额</span>
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawType==2">消费订单金额每满</span>
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawType==3">累计消费订单金额</span>
                                        <span class="font16 color333">{{lotteryInfoForm.orderDrawAmount}}元，</span>
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawType==1">每个订单抽奖次数</span>
                                        <span class="font16 color333" v-if="lotteryInfoForm.orderDrawType!=1">可获得抽奖次数</span>
                                        <span class="font16 color333">{{lotteryInfoForm.drawTimesPerOrder}}次</span>
                                    </p>
                                </el-form-item>
                            </el-row>
                            <el-row>
                                <el-form-item label="用户每日抽奖次数上限：" label-width="176px" class="long">
                                    <span class="font16 color333">{{lotteryInfoForm.dailyDrawTimesLimit}}次</span>
                                </el-form-item>
                            </el-row>
                            <el-row>
                                <el-form-item label="用户每日中奖次数上限：">
                                    <span class="font16 color333">{{lotteryInfoForm.dailyWinningTimesLimit}}次</span>
                                </el-form-item>
                            </el-row>
                        </div>
                        <!-- 参与条件 -->
                        <div class="basicInfo">参与条件：</div>
                        <div class="item">
                            <el-row>
                                <el-form-item label="新老用户：" label-width="176px" class="long">
                                    <span v-for="(item) in (lotteryInfoForm.proUserType + '').split(',')" :key="item" class="ng-binding ng-scope font16 color333">{{getProUserType(item)}} &nbsp;</span>
                                </el-form-item>
                            </el-row>
                            <div class="form-group pdl96" v-if="lotteryInfoForm.proMemberType != null">
                                <label class="color333 font16 ">会员类型：</label>
                                <div class="color333">
                                    <span v-for="(item) in (lotteryInfoForm.proMemberType + '').split(',')" :key="item" class="ng-binding ng-scope font16 color333">{{getProMemberType(item)}} &nbsp;</span>
                                </div>
                            </div>
                            <div class="form-group pdl96" v-if="lotteryInfoForm.channelCodes != null">
                                <label class="color333 font16 ">渠道入口：</label>
                                <div class="color333">
                                    <span v-for="(item) in (lotteryInfoForm.channelCodes + '').split(',')" :key="item" class="ng-binding ng-scope font16 color333">{{getChannelCodes(item)}} &nbsp;</span>
                                </div>
                            </div>
                            <el-row>
                                <el-form-item label="备注：" label-width="176px" class="desc">
                                    <div v-html="lotteryInfoForm.remark" class="contentStyle"></div>
                                </el-form-item>
                            </el-row>
                        </div>
                        <div class="basicInfo">前端页面预览：</div>
                        <div class="item ">
                            <el-row class="mb30">
                                <el-form-item label="投放渠道：" label-width="176px" class="long mb0">
                                    <el-row>
                                        <span v-if="lotteryInfoForm.android">
                                            <img src="../../../../src/assets/checked.png" alt="" style="width:16px;height:16px" class="mr10">
                                            <span class="color333 font16">APP安卓端</span>
                                        </span>
                                        <span v-if="lotteryInfoForm.ios">
                                            <img src="../../../../src/assets/checked.png" alt="" style="width:16px;height:16px" class="mr10">
                                            <span class="color333 font16">APP苹果端</span>
                                        </span>
                                        <span v-if="lotteryInfoForm.h5">
                                            <img src="../../../../src/assets/checked.png" alt="" style="width:16px;height:16px" class="mr10">
                                            <span class="color333 font16">H5页面</span>
                                        </span>
                                        <!-- <el-checkbox label="APP安卓端" name="type" class="el-checkBox-padding noMarginLeft mr10" border v-model="lotteryInfoForm.android" disabled></el-checkbox>
                      <el-checkbox label="APP苹果端" name="type" class="el-checkBox-padding noMarginLeft mr10" border v-model="lotteryInfoForm.ios" disabled></el-checkbox>
                      <el-checkbox label="H5页面" name="type" class="el-checkBox-padding noMarginLeft mr10" border v-model="lotteryInfoForm.h5" disabled></el-checkbox> -->
                                    </el-row>
                                </el-form-item>
                            </el-row>
                            <el-row>
                                <el-form-item label="APP安卓端登录地址：" label-width="176px" class="long" v-if="lotteryInfoForm.androidLink">
                                    <span class="font16 color333">{{lotteryInfoForm.androidLink}}</span>
                                </el-form-item>
                                <el-form-item label="APP苹果端登录地址：" label-width="176px" class="long" v-if="lotteryInfoForm.iosLink">
                                    <span class="font16 color333">{{lotteryInfoForm.iosLink}}</span>
                                </el-form-item>
                                <el-form-item label="H5端登录地址：" label-width="176px" class="long" v-if="lotteryInfoForm.h5Link">
                                    <span class="font16 color333">{{lotteryInfoForm.h5Link}}</span>
                                </el-form-item>
                            </el-row>
                            <el-row>
                                <el-form-item label="H5页面：" label-width="176px" class="long">
                                    <span class="ng-binding ng-scope font16 color333">{{url}} &nbsp;</span>
                                </el-form-item>
                            </el-row>
                        </div>

                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="奖品设置">
                    <div v-for="lotteryAwards in lotteryAwardsList" :key="lotteryAwards.id" class="mb30 pd40 borderD8 w550">
                        <el-form :model="lotteryAwards" ref="lotteryAwards" :size="size">
                            <el-form-item label="奖项等级：">
                                <span class="text color333 font16">{{lotteryAwards.awardsLevelName}}</span>
                            </el-form-item>
                            <el-form-item label="奖品类别：">
                                <span class="text color333 font16">{{lotteryAwards.awardsCategoryName}}</span>
                            </el-form-item>
                            <div v-show="lotteryAwards.awardsCategory === 4">
                                <el-form-item label="积分：" label-width="80px">
                                    <span class="text color333 font16">{{lotteryAwards.awardsRefNum}}</span>
                                </el-form-item>
                            </div>
                            <div v-show="lotteryAwards.awardsCategory !== 1">
                                <el-form-item label="奖品名称：" class="w100 oh">
                                    <span class="text color333 font16 f_l">{{lotteryAwards.awardsRefName}}</span>
                                    <el-button type="text" class="f_r" @click="checkAwards(lotteryAwards)" v-if="lotteryAwards.awardsCategory == 2 || lotteryAwards.awardsCategory == 3">查看</el-button>
                                </el-form-item>
                            </div>
                            <div>
                                <el-form-item label="奖品图片：">
                                    <div class="flex">
                                        <div class="img">
                                            <img :src="lotteryAwards.awardsPicUrl" class="avatar" />
                                        </div>
                                    </div>
                                </el-form-item>
                            </div>
                            <div v-show="lotteryAwards.awardsCategory !== 1">
                                <el-form-item label="奖品数量：">
                                    <span class="text color333 font16">{{lotteryAwards.winningNum}}</span>
                                </el-form-item>
                            </div>
                            <el-form-item label="中奖率：" label-width="80px">
                                <span class="text color333 font16">{{lotteryAwards.winningRate}}%</span>
                            </el-form-item>
                        </el-form>
                    </div>
                </el-tab-pane>
                <!-- <el-tab-pane label="活动统计">
          <div class="toolbar" style="float:right;padding-top:10px;padding-right:15px;"> -->
                <!--表格显示列界面-->
                <!-- <table-column-filter-dialog
              ref="tableColumnFilterDialog"
              :columns="columns"
              @handleFilterColumns="handleFilterColumns"
            ></table-column-filter-dialog>
            </div> -->
                <!--表格内容栏-->
                <!-- <cy-table
              :width="1000"
              :height="250"
              :data="pageResult"
              :columns="filterColumns"
              :showOperation="false"
              :showSelection="false"
              :showEditOperation="false"
              :showBatchDelete="false"
              :showDeleteOperation="false"
              @findPage="findPage"
              ref="CyTable"
            ></cy-table>
        </el-tab-pane> -->
            </el-tabs>
        </div>
    </div>
</div>
</template>

<script>
import KtButton from "@/views/Core/KtButton";
import {
    format
} from "@/utils/datetime";
import CyTable from "@/views/Core/JicTable";
import TableColumnFilterDialog from "@/views/Core/TableColumnFilterDialog";
import {
    darkmagenta
} from "color-name";
import qs from "qs";
import Clipboard from "clipboard";

export default {
    components: {
        KtButton,
        CyTable,
        Clipboard,
        TableColumnFilterDialog
    },
    data() {
        return {
            url: "",
            id: this.$route.params.id,
            lotteryInfoForm: {},
            lotteryAwardsList: [],
            filterColumns: [],
            pageRequest: {
                pageNum: 1,
                pageSize: 10
            },
            pageResult: {},
            columns: [{
                    prop: "memberName",
                    label: "用户昵称",
                    minWidth: 100
                },
                {
                    prop: "awardsLevel",
                    label: "奖项等级",
                    minWidth: 100,
                    formatter: this.showBusinessType
                },
                {
                    prop: "awardsRefName",
                    label: "中奖奖品",
                    minWidth: 100
                },
                {
                    prop: "drawTime",
                    label: "中奖时间",
                    minWidth: 100
                },
                {
                    prop: "recieverName",
                    label: "收货人姓名",
                    minWidth: 100
                },
                {
                    prop: "recieverMobile",
                    label: "联系电话",
                    minWidth: 100
                },
                {
                    prop: "recieverDetailAddress",
                    label: "	收货地址",
                    minWidth: 100
                }
            ],
            filters: {},
            verifyForm: {
                auditRemark: ""
            },
            verifyFormRules: {
                auditRemark: [{
                    required: true,
                    message: "审核意见不能为空",
                    trigger: "blur"
                }]
            },
            dialogFormVisible: false,
            shenhe: 0,
            size: "small",
            multipleSelection: [],
            promotionId: this.$route.query.value,
            activityData: {},
            proUserTypeRadio: [{name: "全部",code: "0"},
                {name: "新用户",code: "1"},
                {name: "老用户", code: "2"}
            ],
            channelCodes: [{name: "全部",code: "0"},{name: "企业微信",code: "1"},],
            proMemberType: [{name: "全部",code: "0"},
                {name: "普通会员",code: "1"},
                {name: "we2000", code: "2"},
                {name: "分期会员", code: "3"}
            ],
            awardsRefNameForm: [], //查看奖品
            awardsRefNameVisible: false, //奖品名称查看
            showGoods: false, //显示商品或者优惠券
            //商品弹窗 查询参数
            formInline: {
                thirdSkuId: "",
                goodsName: "",
                goodsCategory: "",
                merchantId: "",
                storeId: "",
                start: 1,
                limit: 10
            },
            couponformInline: {
                start: 1,
                limit: 10
            },
        };
    },
    methods: {

        getChannelCodes(code) {
            let item = this.channelCodes.find(function (item, index) {
                return item.code == code;
            });
            return typeof item == "undefined" ? "" : item.name;
        },
        getProUserType(code) {
            let item = this.proUserTypeRadio.find(function (item, index) {
                return item.code == code;
            });
            return typeof item == "undefined" ? "null" : item.name;
        },
        getProMemberType(code) {
            let item = this.proMemberType.find(function (item, index) {
                return item.code == code;
            });
            return typeof item == "undefined" ? "null" : item.name;
        },
        //获取抽奖活动详情
        getLotteryRuleInfo() {
            let params = {};
            params.id = this.id;
            var that = this;
            this.utils.request.getLotteryThemeInfo(params, res => {
                if (res.code == "0000") {
                    that.lotteryInfoForm = res.data;
                    that.url = window.location.origin + '#/pages/MarketingTools/LargeTurntable/terminal?promotionCode=' + res.data.promotionCode;
                    if (res.data != null) {
                        that.lotteryInfoForm.android = ["1"].includes(res.data.launchChannels);
                        that.lotteryInfoForm.ios = ["2"].includes(res.data.launchChannels);
                        that.lotteryInfoForm.h5 = ["3"].includes(res.data.launchChannels);
                        if (res.data.lotteryAwardsList.length != 0) {
                            for (var i = 0; i < res.data.lotteryAwardsList.length; i++) {
                                if (res.data.lotteryAwardsList[i].awardsLevel == 1) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "一等奖";
                                } else if (res.data.lotteryAwardsList[i].awardsLevel == 2) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "二等奖";
                                } else if (res.data.lotteryAwardsList[i].awardsLevel == 3) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "三等奖";
                                } else if (res.data.lotteryAwardsList[i].awardsLevel == 4) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "四等奖";
                                } else if (res.data.lotteryAwardsList[i].awardsLevel == 5) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "五等奖";
                                } else if (res.data.lotteryAwardsList[i].awardsLevel == 6) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "六等奖";
                                }
                                if (res.data.lotteryAwardsList[i].awardsLevel == 7) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "七等奖";
                                }
                                if (res.data.lotteryAwardsList[i].awardsLevel == 8) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "八等奖";
                                }
                                if (res.data.lotteryAwardsList[i].awardsLevel == 9) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "九等奖";
                                }
                                if (res.data.lotteryAwardsList[i].awardsLevel == 10) {
                                    res.data.lotteryAwardsList[i].awardsLevelName = "十等奖";
                                }
                                if (res.data.lotteryAwardsList[i].awardsCategory == 1) {
                                    res.data.lotteryAwardsList[i].awardsCategoryName = "谢谢参与";
                                } else if (res.data.lotteryAwardsList[i].awardsCategory == 2) {
                                    res.data.lotteryAwardsList[i].awardsCategoryName = "商品";
                                } else if (res.data.lotteryAwardsList[i].awardsCategory == 3) {
                                    res.data.lotteryAwardsList[i].awardsCategoryName = "优惠券";
                                } else if (res.data.lotteryAwardsList[i].awardsCategory == 4) {
                                    res.data.lotteryAwardsList[i].awardsCategoryName = "积分";
                                }
                            }
                            that.lotteryAwardsList = res.data.lotteryAwardsList;
                        }
                    }

                } else if (res.code == "9999") {
                    that.$message({
                        message: res.msg,
                        type: "error"
                    });
                }
            });
        },
        //获取抽奖活动统计分页数据
        findPage: function (data) {
            let this_ = this;
            if (this_.filters == undefined || this_.filters == null) {
                this_.filters = {};
            }
            this_.filters.start = this.pageRequest.pageNum;
            this_.filters.limit = this.pageRequest.pageSize;
            this_.filters.themeRefId = this_.id;
            this.utils.request.getLotteryDrawRecordList(this_.filters, function (res) {
                if (res.data.rows == null) {
                    res.data.rows = [];
                }
                this_.$refs.CyTable.findPage({
                    content: res.data.rows,
                    total: res.data.total
                });
            });
        },

        //提交审核
        submitReview: function (data) {
            this.$confirm('确定提交审核？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: "warning",
                closeOnClickModal: false,
            }).then(() => {
                let that = this;
                var params = {};
                params.id = this.id;
                params.status = 2;
                this.utils.request.closeLotteryActivity(params, res => {
                    that.$message({
                        message: "提交审核成功",
                        type: "success"
                    });
                    that.getLotteryRuleInfo();
                });
            }).catch(() => {});
        },
        //审核
        review: function (data) {
            this.dialogFormVisible = true;
            this.verifyForm.id = this.id;
            this.$nextTick(() => {
                this.$refs['verifyForm'].clearValidate();
            });
        },
        //审核
        reviewDialog: function (data) {
            let that = this;
            this.verifyForm.verifyStatus = data;
            that.utils.request.verifyLotteryActivity(this.verifyForm, res => {
                if (res.code == "0000") {
                    that.dialogFormVisible = false;
                    that.$message({
                        message: "审核完成",
                        type: "success"
                    });
                    that.getLotteryRuleInfo();
                } else {
                    that.$message({
                        message: "审核失败",
                        type: "error"
                    });
                }
            });
        },
        reviewDialogNo: function (data) {
            this.$refs.verifyForm.validate((valid) => {
                if (valid) {
                    let that = this;
                    this.verifyForm.verifyStatus = data;
                    that.utils.request.verifyLotteryActivity(this.verifyForm, res => {
                        if (res.code == "0000") {
                            that.dialogFormVisible = false;
                            that.getLotteryRuleInfo();
                            that.status = 0;
                            that.$message({
                                message: "审核完成",
                                type: "success"
                            });
                        } else {
                            that.$message({
                                message: "审核失败",
                                type: "error"
                            });
                        }
                    });
                }
            });
        },
        // 处理表格列过滤显示
        handleFilterColumns: function (data) {
            this.filterColumns = data.filterColumns;
            this.$refs.tableColumnFilterDialog.setDialogVisible(false);
        },
        // 处理表格列过滤显示
        initColumns: function () {
            var temp = [];

            $.each(this.columns, function (key, val) {
                temp.push(val);
            });
            this.filterColumns = temp;
        },
        //复制活动链接
        copyLink() {
            var clipboard = new Clipboard(".tag-read");
            clipboard.on("success", e => {
                this.$message({
                    message: "复制成功,快去分享吧",
                    type: "success"
                });
                // 释放内存
                clipboard.destroy();
            });
            clipboard.on("error", e => {
                // 不支持复制
                this.$message({
                    message: "该浏览器不支持自动复制 ",
                    type: "error"
                });
                // 释放内存
                clipboard.destroy();
            });
        },
        submitFormAdminNotPass() {
            let this_ = this;
            this.dialogVisibleAdmin = false;

            let callback = res => {
                this_.activityData.status = 4;

            };
            this.adminDataForm.id = this.promotionId;
            this.adminDataForm.status = 4;
            this.utils.request.promotionUpdate(this.adminDataForm, callback);
            this.shenhe = 0;
        },
        //关闭审核弹窗
        handleClose() {
            this.dialogFormVisible = false;
        },
        //查看商品或优惠券
        checkAwards(item) {
            console.log(item)
            if (item.awardsCategory == 2) {
                let that = this;
                this.formInline.storeIds = null;
                this.formInline.skuId = item.awardsRefId;
                this.utils.request.goodsQuerySkuPage(this.formInline, res => {
                    if (res.code == "0000") {
                        that.awardsRefNameForm = res.data.rows;
                        that.awardsRefNameVisible = true;
                        that.showGoods = true;
                    }
                });
            } else if (item.awardsCategory == 3) {
                let that = this;
                this.couponformInline.promotionId = item.awardsRefId;
                this.utils.request.couponQueryConfigPage(this.couponformInline, res => {
                    if (res.code == "0000") {
                        that.awardsRefNameForm = res.data.rows;
                        that.awardsRefNameVisible = true;
                        that.showGoods = false;
                    }
                });
            }
        },
        //table的双色条纹
        tableRowClassName({
            row,
            rowIndex
        }) {
            if (rowIndex == 1) {
                return "warning-row";
            } else if (rowIndex == 3) {
                return "success-row";
            }
            return "";
        },

        //修改table header的背景色
        tableHeaderColor({
            row,
            column,
            rowIndex,
            columnIndex
        }) {
            if (rowIndex == 0) {
                return "background-color:rgb(250,250,250);";
            }
        }
    },
    created: function () {
    },
    mounted() {
        this.getLotteryRuleInfo();
        this.initColumns();
    }
};
</script>

<style lang="scss" scoped>
@import '../../../assets/css/public.scss';

.border {
    color: #666666;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px;
    border-bottom: 1px solid #666666;
    padding-bottom: 3px;
}

.text {
    height: 32px;
    line-height: 32px;
}

.basicInfo {
    width: 176px;
    text-align: right !important;
    margin-left: 0 !important;
}

.form-horizontal .control-label {
    padding-top: 5px;
    margin-bottom: 0;
    text-align: right;
}

.form-horizontal div {
    font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif,
        "Regular", "Microsoft YaHei";
    font-size: 12px;
    color: #666666;
    background-color: transparent;
    -webkit-font-smoothing: antialiased;
    line-height: 1.42857143;
    word-wrap: break-word;
}

.form-horizontal .control-label {
    padding-top: 3px !important;
}

.mgt15 {
    margin-top: 15px;
}

.title {
    font-weight: 700;
    border-left: 4px solid #ddd;
    padding-left: 10px;
}

.item {
    /deep/ .el-form-item {
        margin-bottom: 30px;

        .el-form-item__label {
            height: auto !important;
            line-height: 1 !important;
        }
    }

    .desc {
        /deep/ .el-form-item__label {
            line-height: 32px !important;
            height: 32px !important;
        }
    }
}

.rules {
    /deep/ .el-form-item {
        margin-bottom: 30px;

        /deep/ .el-form-item__label {
            height: auto !important;
            line-height: 1 !important;
        }
    }

    .long {
        /deep/ .el-form-item__label {
            text-align: right;
        }
    }

}

.input {
    width: 30%;
}

.lineDev {
    border-bottom: 1px solid #dddddd;
    border-style: dashed !important;
    background-color: transparent;
    border-top-width: 0px;
    border-right-width: 0px;
    border-left-width: 0px;
    margin-bottom: 10px !important;
}

.contentStyle {
    position: relative;
    padding: 8px 0px 15px 0px;
    max-height: 600px;
    width: 50%;
}

.w80 {
    width: 80px
}

.pdl30 {
    padding-left: 30px;
}

.lh25 {
    line-height: 25px;
}

.pdl60 {
    padding-left: 60px;
}

.pdl96 {
    padding-left: 96px;
}

.w144 {
    width: 144px;
}

.oe {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.width100 {
    width: 97px;
}

.width120 {
    width: 150px;
}

.mr10 {
    margin-right: 10px;
}

.mb10 {
    margin-bottom: 10px;
}

.ml33 {
    margin-left: 33px;
}

.pdl30 {
    padding-left: 30px;
}

.pdt20 {
    padding-top: 20px;
}

.flex {

    .img {
        width: 88px;
        height: 72px;
        border: 1px dashed #d9d9d9;
        margin-right: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;

        img {
            height: 90%;
        }
    }
}

.pd40 {
    padding: 40px !important;
}

.borderD8 {
    border: 1px solid #D8D8D8;
    border-radius: 6px;
}

.w550 {
    width: 550px;
}

.tab-container {
    /deep/ .el-tabs {
        .el-tabs__header {
            margin-bottom: 30px !important;
        }
    }
}

.mb0 {
    margin-bottom: 0 !important;
}
</style>
